import 'package:flutter/material.dart';
import 'package:flutter_demo2/material-demo/hello_world/random_words.dart';
import 'package:flutter_demo2/material-demo/hello_world/shopping_list.dart';
import 'package:flutter_demo2/material-demo/hello_world/todo_list.dart';
import 'package:flutter_demo2/widgets/navigator_text_btn.dart';

class HelloWorld extends StatefulWidget {
  const HelloWorld({Key? key}) : super(key: key);

  @override
  State<HelloWorld> createState() => _HelloWorldState();
}

class _HelloWorldState extends State<HelloWorld> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.lime,
      ),
      routes: {
        '/HelloWorldHome': (_) => const HelloWorldHome(),
      },
      initialRoute: '/HelloWorldHome',
      home: HelloWorldHome(),
    );
  }
}

class HelloWorldHome extends StatelessWidget {
  const HelloWorldHome({
    Key? key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: const Text('HelloWorld'),
        actions: [IconButton(onPressed: () {}, icon: Icon(Icons.add))],
      ),
      body: SingleChildScrollView(
        child: Center(
          child: Column(
            children: [
              NavigatorTextBtn(text: 'RandomWords', widget: RandomWords()),
              NavigatorTextBtn(
                text: 'ShoppingList',
                widget: ShoppingList.randomExample(),
              ),
              NavigatorTextBtn(text: 'TodoList', widget: TodoList()),
            ],
          ),
        ),
      ),
    );
  }
}
